package cn.bdqn.fragment03;

import android.support.v4.app.FragmentManager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.AdapterView;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity implements ListFragment.OnItemClickListener {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

    @Override
    public void seleted(int i) {
        //判断前面的索引有没有传过来
        //Toast.makeText(this, ""+i, Toast.LENGTH_SHORT).show();
        FragmentManager fragmentManager =getSupportFragmentManager();
        ContentFragment contentFragment=(ContentFragment) fragmentManager.findFragmentById(R.id.f_content);
        switch (i){
            case 0:
                //Toast.makeText(this, "android", Toast.LENGTH_SHORT).show();
                //获取管理器，得到Manager

                contentFragment.showMsg("android");
                break;
            case 1:
                //Toast.makeText(this, "IOS", Toast.LENGTH_SHORT).show();
                contentFragment.showMsg("IOS");
                break;
            case 2:
                //Toast.makeText(this, "WP", Toast.LENGTH_SHORT).show();
                contentFragment.showMsg("MP");
                break;
            default:break;

        }
    }
}
